package com.leo.huawei;

import java.io.UnsupportedEncodingException;
import java.util.Scanner;

/**
 * Created by LEO on 2018/4/18.
 */
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.next();
        int n = in.nextInt();

        int num = 0;
        str = str.replaceAll("\\d+","");

        char[] chars = str.toCharArray();
        StringBuffer res = new StringBuffer();
        for (int i = 0; i < chars.length; i++) {
            try {
                byte[] gbks = String.valueOf(chars[i]).getBytes("GBK");
                num += gbks.length;
                if (num <= n){
                    res.append(String.valueOf(chars[i]));
                }else{
                    break;
                }
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }
        System.out.println(res.toString());
    }
}
